$(function () {

    var courseIds = $('#courseIds').val();
    var subjectIds = $('#subjectIds').val();
    listClasses(1, courseIds,subjectIds);

    $('body')
        .on('click', '#btn1, #btn2', function () { // 搜索
            listClasses(1, courseIds,subjectIds,false);
        })
        .on('click','#refresh',function(){
            listClasses(1, courseIds,subjectIds,true);
        });

});

/**
 * 加载班级数据
 * @param pageNo
 * @param courseIds 课程ID
 * @param subjectIds 专业ID
 */
function listClasses(pageNo, courseIds,subjectIds,flag) {
    var params = $('#search-form').serializeJSON();
    if(flag){  params.clear();  }
    params.courseIds = courseIds;
    params.subjectIds = subjectIds;
    params.ids = $('#ids').val();
    params = JSON.stringify(params);
    var obj = {
        url: baseloaction + '/admin/classes/ajaxSelectClassesListPage',//请求URL
        contextId: 'oc-ibox-content',//响应内容页面设置内容ID
        params: params,//请求参数
        pageNo: pageNo,//页码
        pageCall: listClasses, //分页回调加载数据(点击上下页时调用,该方法也在加载页面完成时调用)
        selectAllId: 'all-select',        //全选框ID
        callback: function () {
            $('#count').html(total);
        }
    };
    ajaxGetListData(obj);
}